package callgraph;

import java.util.HashMap;
import java.util.Set;

public class Identities {
	
	private static int ID;
	private HashMap<String, Integer> table = new HashMap<String, Integer>();
	
	public Identities() {
		if (ID != 0) throw new UnsupportedOperationException();
	}
	
	public int size() {
		return ID;
	}
	
	public int getID(String name) {
		Integer val = table.get(name);
		if (val == null) {
			val = ID++;
			table.put(name, val);
		}
		return val;
	}
	
	public Set<String> getKeys() {
		return table.keySet();
	}
	
}